package com.metaera.app.controller.view;

import com.metaera.app.controller.core.IPaginationPresenter;
import com.metaera.app.controller.view.core.IPaginationView;
import com.scwang.smart.refresh.layout.api.RefreshLayout;
import com.scwang.smart.refresh.layout.listener.OnRefreshLoadMoreListener;

import and.fast.statelayout.OnAnewRequestNetworkListener;
import androidx.annotation.NonNull;

public class RefreshLoadMoreView<T> implements OnRefreshLoadMoreListener, OnAnewRequestNetworkListener {
    protected IPaginationPresenter<IPaginationView<T>, T> mPaginationPresenter;

    public RefreshLoadMoreView(IPaginationPresenter<IPaginationView<T>, T> paginationPresenter) {
        mPaginationPresenter = paginationPresenter;
    }

    @Override
    public void onAnewRequestNetwork() {
        mPaginationPresenter.requestRefresh();
    }

    @Override
    public void onRefresh(@NonNull RefreshLayout refreshLayout) {
        mPaginationPresenter.requestRefresh();
    }

    @Override
    public void onLoadMore(@NonNull RefreshLayout refreshLayout) {
        mPaginationPresenter.requestLoadMore();
    }

}
